#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void paixu(char* e1, char* e2, size_t bes)
{
	int x = 0;
	for (x = 0; x < bes; x++)
	{
		char a = *e2;
		*e2 = *e1;
		*e1 = a;
		e1++;
		e2++;
	}
}
void my_sort(void* best, size_t sz, size_t bes, int(*p)(const void* e1, const void* e2))
{
	int x = 0;
	for (x = 0; x < sz - 1; x++)
	{
		int y = 0;
		for (y = 0; y < sz - 1 - x; y++)
		{
			if (p( (char*)best + y * bes, (char*)best + (y + 1) * bes)>0)
			{
				paixu((char*)best + y * bes, (char*)best + (y + 1) * bes,bes);
			}
		}
	}

}
int bijiao(const void* e1, const void* e2)
{
	return *(int*)e1 - *(int*)e2;
}
int main()
{
	int arr[] = { 9,6,3,8,5,2,7,4,1,10,0,12,15,14,13 };
	size_t sz = sizeof(arr) / sizeof(arr[0]);
	my_sort(arr, sz, sizeof(arr[0]), bijiao);
	int x = 0;
	for (x = 0; x < sz; x++)
	{
		printf("%d ", arr[x]);
	}
	return 0;
}